fix getting max quantity for flowmap