Worked in scott's comments and got tests working again

This is embarrassing. For some reason these minor changes were somehow deleted during the rebase. Which is strange as they're only half a commit. May have deleted the wrong bit while resolving a merge conflict.

Names with special characters (e.g. spaces) are now handled correctly.