fix #3451 and #4248

pre-load PFS, finalize it *after* Lua has been loaded