test.js does perf testing; Fix collision bugs

Collision would find too many things intersecting the given rectangle.
This was due to using the wrong counter variable in a comparison.

Currently there seems to be a memory leak, this needs to be fixed.