bugfix and merged 2 if methodes