Added type check of callback parameter.