fixed pointer increment bug