Fixed indexing bug in add/remove