cleanup and fixes to metadata extraction while importing results