Crashes fixed

Now there are fewer crashes on both server and client applications