fixed bugs in remove