some fixes and clear error reporting