Fix Firefox hanging bug