I can't help you with the code part... but in my experience "BADFREE" usually means there is something wrong with LookBack (like not enough).

You can try commenting-out the LookBack and sometimes Zorro will assign it what it thinks it needs (that doesn't always work but worth a try).

Also LookBack should be an int, not var, I believe.