fix if statement in combining code