fixed bug in getSome, added query function