Fix bug in RFC5444 generator and add testcase for it.