Fixed wrong looping array