Add error handling for unappliable patch