Fixed code due to broken error messages