Workaround issue with names ending in spaces. Might break other stuff