improved autosize