Fixed some problems with finalizer particularly multi file mode.