array.remove bug fix