Forward-porting sid collision handling

As with #22