fix onError handling for async tasks