Fix Null pointers in API

Its possible for update to refrence a null string, and this fixes the
null pointers by checking first