More bug fixes

Fixes: Couldn't connect multiple times during a single application run,
that is now possible after a fix for the time check on the network
thread as well as packet registeration. Potential memory leak caused by
encryption register fixed.