error check added for total weight