tighten PID check in get_metadata