Error-checking

Change-Id: I7e03a3d53c62e5da801c6c75f32c2383ae6a741c