error checking if else condition