Fix handling of weights, add examples and tests about it