add exit check