fix a bug in the determination of max_vms