handling wrong syntax queries with Bad request error