fix issue with flatten data

Fixes #85