Fix if else clauses. #147
Fix a threshold and a typo error.