Properly replace absolute paths when using prefix