fixed dumb arithmetic mistakes