Bugfix for Error logging