Fix crash when clicking at min or max