Reduce the loop times for speed

Reduce the loop times for speed in `_fnDetectHeader` & `_fnDrawHead`