fix handle status to properly clean up on error.