fixed compatibility issues with window script