Fixed bug in remove()