Fixes bug that causes constant weights.