A few minor fixes

I noticed a bug that prevented this from working correctly in IE7 (!), and while I was fixing that bug Resharper pointed out a few other minor issues that I figured I'd take care of while I was at it.