fixing path parsing to expand ~'s