fixed persistence not working for multiple docs
merged from master