Added nullcheck before creating function for message parameters.