Added onerror handler.