this seems to fix the logical min/max error