Added support for foreign scalar functions.