fix order of returned items in case of query with limits