Fix the bug with constants in the query