Added guard for func being undefined