Fixed data loss regression caused by previous commit

Updated test. So it will never happen again.