add expanduser to allow ~/ in file name

add expanduser to allow ~/ in file name