resize is called when an instance is created