improve auto resize