undo failed changes

before raising

otherwise, invalid values were still accepted