Added two asserts to catch a segfault