adds some error reporting