Fixed a couple of bugs.
Merge pull request #209 from Clashnia/various

Fixed a couple of bugs.