Fix some bugs for halo build