Fix wrong endpoints handling