handle invalid buildid more gracefully
use defaultdict