added missing initialization and set pointer to NULL after deletion