Handle empty path correctly