fix if/else problem