Fix to problem first_and_last_occurences