add tests fix duplicate remove behavior