New bugfixes and better error handling