Fix crash on invalid chars in path