replaced a few INTs with INT_PTRs