BugFix: limit the count to supported range in min/max