fix typo in segment cleanup
fix typo in if statements
fix typo