added expansion of ~ when used as input parameter