Fixing error with null values