Thread test

fixes the weird freezing bug