replace funky statement by simple if