Fix removeElement to work for everything.