fix bug in remove method