Critical script engine bug fix