resolved compatibility problems. Added sysos for debugging.