be more defensive in finalize