Fixed a compatibility issue with Firefox (looks like a bug in FF with nested function scopes).