add autosize detection