Fixed bug for broken patch apply in some use cases