Bug fixes.
Merge pull request #136 from mshamash/master

Bug fixes.