fixed potential exception thrown from finalizer