closure + mistakes with the for-loop