fixed bug with pointers