extra error reporting and a bugfix