add if statement by fixing #50