Simplify patching (Credits to marcin1147)