fix typo, improve error reporting