Fix Null pointers in API

Its possible for update to refrence a null string, and this fixes the
null pointers by checking first
Merge pull request #5 from sanjay900/master

Fix Null pointers in API - Lets try this again