fixed nonetype loop