sync with source: http://code.google.com/p/elmah/source/detail?r=f7149a0ba15d9a6c28ff796dbb315cb62116fd6e
back-porting some fixes