working version after aply my patches