Fixed array issue where items were not being removed correctly