added support for onDestroy factory listener