Fixed reference to invalid pointer