Fix bug in unattachAll