Fixed pointer dereference problem