Properly read and correct links to internal paths.

From #750 and #3249.