fixed force close and pulled the callback out of the for loop