Bugfixes on scan and subscribe callback