Fixing segfault which was occuring while executing tests