HotFix, potentially fixes #260 through catching a null node

Added copyright
Reformatted code
Rearranged code
Merge pull request #435 from thatsIch/hotfix-260

HotFix, potentially fixes #260 through catching a null node