Upgrading server code to return -1 when there are no path