Fix for "Trying to get property of non-object" notice
Merge pull request #7 from adrianbj/master

Fix for "Trying to get property of non-object" notice