Build against j7, remove some deprecated casts