Fixed memory problem
Finished hotfix fix_model.