Change onError to allow onError to be updated after initialization