Fix limiting of large results
Fix errors from manual queries
Remove excess debug printing