Add more error handling

Change-Id: I353b9712eb9f5055eda9c20921c2554bd6427ee1