Added checks if function exists before invocation