trouble with min/max computing