Saving inside a thread is a bad idea, plus fixing bugs