Fix mistype in error message
use Object.keys
Fix heading nesting detection
Better error handling in attributes
Merge branch 'misc'