Fixing unserialize problem and non object errors.