Fixed a bug that the script does not work with ADVANCED_OPTIMIZED