Fix NULL pointer dereference in the ex_data code