Better handling of exit process