fix issue: call fn first