added onHidden option