Removed problem for out-of-range weight in config

Previously the code was changing priority instead of weight, when weight in config was out of range.