BUG: forget to inc j