Fixing issue with nil values