Adding error listener.