fix finalize TODO : add test for finalize