Fix bug in instantiation of deferred and endpoint