Fixing possible null reference