fix extra if statement