changed original fastPtr initial value and control logic;even the original method is correct, but this new modified control logic is more recommended