Many fixes. Mostly error reporting.