query works as intended