fix index an fk duplicate issue