Fixing uninitialized pointer crash