Fix detach/append issue (bug #1)