fixed min bug