Attempt to fix panic caused by pointer dereference