FAIMS-238: fixing bugs in generating sync database