detect before run