fixes #443: merge heading fixes from @htthach