Tests for empty frontmatter and plain files, and a bug fix