improved makexpi.sh