add if statement

With the help of *Mark Ableidinger