fixed routing bug and added missing tests