Merge pull request #521 from david0/fix-issue-520

IE7+IE8 compatibility (fixes #520)