Fix bug in more robust endpoint code