check for path existence first