Added check to weight to close #1

I needed to fix it for myself, so I thought I'd submit a pull request :) Do you like this change?