Several small fixes.
Merge pull request #229 from brendandburns/fix

Several small fixes.