php compatibility fixes