improvements

important part is setting 0 when the demand is 0 !!!