Miscellaneous fixes.
Merge pull request #261 from crazysam/dev

Miscellaneous fixes.