Fixing bugs from serialization refactor.