missing headers, fixed CHECK_PTR