Fixed error on serializing to save on file.