testing code of check_valid_ptr