fix bugs in delegation