Fix copy/paste error handling bug