Merge "Prevent IndexOutOfBoundsException while removing activities"