fixed if statement in error handling code