fix typos and catch IOException