Fixed problem when deleting endpoints