get path safely