Fix bug with hitting wrong endpoint