Corrected if statement and wording of error