Better fix for invalid values