Bugfix + test error logging