Fixed pointer reference issue