Is the RD-M4000 attached properly?
The 'bracket axle unit' or 'b-link' on shadow derailleurs needs to be in a horizontal position.
I've seen people incorrectly attach shadow derailleurs with the 'bracket axle unit' in a vertical position, they had shifting problems.