fixing segfault I think