Could you share a full runnable code? See Please Read: Make It Easier to Help You where it says to post a minimal working example of your code (i.e. something we can run as-is, including the definition of all of the objects/variables needed and the packages you loaded). It should be something we could copy and paste and be able to run without modification.