Update removeElement(int i) which used to cause segfault
Fixing bug