Fixed some bugs, but still quite a lot remaining. At arount packet 20 everything dies.