Fix to address freezing bug