fixing TypeError in Firefox

This should fix issue #12