fixed an erroneous if statement