fix database to support bidirectional