Fix if/else clause correctly (Ref #314)