cleanup database and exception