fixing up queries