fixed pointer reference problems