fixing TypeError in Firefox