correct data integrity problem. fixes #251