fix nil handling for histry readin