fix typo causing writing into incorrect file