fixes to binary database restore