Added check for weight sum