IE7+IE8 compatibility (fixes #520)