fix for MinXY
code clean