Fixed a few null pointer issues.
Merge pull request #19 from Zedzap/NullPointerErrors

Null pointer errors