fix crossplatform compatibility issues