ugly bugfix in the error handling