fixing bug in firefox and sometimes chrome