update serialize from matlab branch
improve save mode due escaping single quotas and replace them to double single quotas