next_assignment routine fixed