this is broken, throws exception for records without headers