fixup lasthash calculation