Adds separate handler for error events; changes files encoding to utf8