Fix calculation of relative paths