Fixing patch logic properly