improvements on query class

fixed #14
fixed #15