fixed the compatibility problems with different writing