Fix type conversion bug

Discovered while making test data more noisy (i.e. messing with order, extra data with some wrong types, etc.)