Fix the bug when the endpoint is Null