fixing database statement