add first and last flags