fix issue with removing last element in collection