Fixed some NullPointerExceptions
Merge pull request #37 from tasomaniac/patch-1

Fixed some NullPointerExceptions