fix typo and remove unnecessary if