proper path escaping when subsitituting the values (fixex #304)