If the heading name ends on a space (eg 'xxxx ') the link will not work.
Not sure, if this is a bug or inevitable. Took me a while to find it. (of course a space at the end of a heading makes not much sense also)
Best regards,
Stefan