use pq.erase instead of setting pointers to NULL