fix TypeError when sourceContents is already deleted.