Fixed a few bugs relating to the production server and double-free crashes.