Bugfixes on error