fix pointer checking