Safer relative path calculation