Could you post a full MWE so that we may look at type-instabilities? Perhaps there are more that need to be resolved