fix loop speed issue