endless loop fix and stuff