fix one sql query bug