better error handling around merges