some bug fix to cross-compile