Fixed success flag in the memory regions function