Fix model SQL bug for production