fix bad pointer crash