a little clean-up and some fixes
expanding ~ to home dir on unix