Trying to get thread to not crash (it still does)