modified on.exit
updated doc