added conditions on query
Merge branch 'hotfix/conditions_on_query' into rel/0.2