fix some minor bugs with url encoding