Fix potential bug where patches could be mixed