set error to true from the start instead of reassigning