improve urllib compat, fixes #52