added chkpath function