Fixes and updating max_demand