Bug fixes

Fixes bug in runtime
Workaround for bug #92
Various other minor code fixups.
Merge pull request #99 from charsleysa/metadata

Bug fixes