fix bug in the weight function for the emu case