Small fixes for custom models and tidy up imports.