Compatibility fixes for older browsers

As it says on the tin.