fix scope issue with AutoCompileTrick