Make sure that node names do not contain illegal characters, fixes #408.