Fix rmarkdown plugin bug, metadata was not written to file
Fix rmarkdown plugin bug: we might not have a lib directory