fixed null-handling after refactoring to SQL parameters