Fixed queries with NULL values or parameters (issue #20)