Fixed issue with IS NOT NULL in queries adding an extra parameter