many compatibility fixes