Fixed #2431: modify codes for supporting advance compile.