Fixing pointer dereference