hotfix

moved re compilation out of the loop