Handling of out-of-range weights in config

Previously the code was changing priority instead of weight, when weight in config was out of range.
Merge pull request #55 from kgawda/master

Removed problem for out-of-range weight in config