fixes handling of None to NULL querying