Correctly set NULL and NOT_NULL in query scan operations. Fixes #24