Added support for foreign objects callback