Fix Server not crashing

implemented thread