debuglabelcomplete: compute active branch heads correctly

The previous computation was simply wrong.