Call callback function if it is provided.