Minor bugfixes, especially on error reporting