replace ~ with $HOME