fix -g2 and add testing
only minify globals when relooping
update test