merged latest fix which converted loops to low-level asm