added err() to ERN; also emit() loop fix