Small fix to make it work with different weights.