Fixing segfault. Making proper global object variables