little optimization in the error adding script