invalid pointer mess solved