fix memweight()