Removed memory leak in model.