Improved error handling and conflict cleanup