small improvements

Small improvements:
 - cli parsing
 - query added to uri
 - additional output check