replace condition for cursor bounds with min/max