correct errors for invalid cases