RG-141 Fixed finalize function