better logging of some errors and fixed a typo