fix bug in tare function