adding null and notNull comparisons to query decoder
changed the try catch blocks to separate error handling