fix some demandimport related bugs