fix 960932 by add boundary checks on run_before
add parentheses
Merge pull request #168 from licaiguo/fix-960932

fix 960932 by add boundary checks on run_before -- review request #51