Fix for model instances not being pickleable