Fixed bug in remove operation