fixed 'create_query' helper method