Ensures replacing the ~ character only at the beginning of the route

fixes the issue #37