Fixed a couple elastic kernel bugs including a potential segfault.