error on undefined pic + for loop