some changes in filepath concat assertion
fix a bug and rename a variable for clarity
make target file path absolute to make concatenating with .. working