Fix hunging for async calls when an error occurs