fix typo and added finish procedure