Fixed JS deadlock