Update endpoint creation to be more robust