Refactor backend position. libd must not depends on any backend.