added a function for pointer errors