Bug when removing document