Fix another infinite loop bug and also try and fix some random exception which keeps happening