Fixed some server and client crashes.