fixes to dataset and decode

various bug fixes