replace ~ with root