added a check to see if data is initialized, added a status code check