fixed bug with null min