update shapefile.py from upstream