added pen_id check