fixed NPE on double-remove of last element