[Jay] Fix memory corruptions: out-of-bounds and uninitialized value.