fixed placement of else statement