fix min, max bug
undefined check