IMPROVED: relative path handling