Add check for existence of function, before trying to call it.