Add extra guards in case a call to function fails. For example, the result of `ReadMemory()` cannot be trusted when `error.Fail()` is true, and this change ensures the code executes properly according to the value of the error. Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me>