Fix bug in query lots