Add some checks before calling functions to allow collection support.