Fix bug in unmerged-commits (with regression test)