fix a bug in set delegate on/off