Fix for Issue #336
Clean-up, also fixes Issue #331
Merge pull request #339 from PeterBjuhr/master

Fixes MusicXML export