Correctly pass query params to db