improve auto expand mode