Various metadata extraction fixes