Improved postinstall.sh script