Fix some bugs caught by R CMD check
Some protection against empty .Rmd files