fixing URI parse issues from original repo #50 courtesy of @sandmark