Prevent v8 optimisations and add boundary checks

Fixes #1
Assign iterations to another variable and pre-decrement (off by one error)