Fix endpoint detection