protect against invalid inputs