fixed some decoding bugs that let the server crash