fix the model and sql