Removed incorrect prefix calulation (error when root contains trailing slash), to prefer input.