BUG: Fixed handle sql query