fix dereferencing of undefined pointer