Fix returning the current endpoint instead of error