Improve get winwidth
Improve resize behavior