added handling of duplicate errors