improve resize, more effectivy and it work correctly with the plot