DEV: fix bug calculating weights