fix bug when calling listen before add_listener