Fix pubPath function and tests