improved patch check