fix problem with query