fix path code calculation