added automatic resize condition
added automatic resize condition