fix calendar merge bug and db bug