improve url normalizing (fixes #164)