A hydraulic system for a working machine, the system comprising: a first electric machine connected to a first hydraulic machine; a second electric machine connected to a second hydraulic machine, an output side of the second hydraulic machine being connected to an input side of the first hydraulic machine; at least one hydraulic consumer hydraulically coupled to an output side of the first hydraulic machine via a supply line and configured to be powered by the first hydraulic machine; a first return line hydraulically coupling the hydraulic consumer to an input side of the first hydraulic machine; wherein the second hydraulic machine is configured to provide a flow of hydraulic fluid from a hydraulic fluid supply to the input side of the first hydraulic machine if a requested flow from the first hydraulic machine exceeds a flow of the first return line and to recuperate energy if the requested flow from the first hydraulic machine is lower than the flow of the first return line; wherein the at least one hydraulic consumer comprises a first hydraulic cylinder connected to the first return line and a second hydraulic cylinder having a second return line directly connected to the input side of the first hydraulic machine and to the output side of the second hydraulic machine, and characterised in that the first return line is connected from a first side of the first hydraulic cylinder to the hydraulic fluid supply via a pressure limiter and to the input side of the first hydraulic machine and to the output side of the second hydraulic machine via a check valve allowing a flow from the first return line to the second return line, wherein the pressure limiter is configured to allow a flow from the first return line to the hydraulic fluid supply if the pressure in the first return line is lower than the pressure in the second return line, and if the pressure of the first return line is higher than a threshold pressure of the pressure limiter, and wherein the system further comprises a return valve block connected to a first side of the second hydraulic cylinder, the return valve block comprising a first return check valve arranged to allow a flow from the first side of the second hydraulic cylinder to the second return line and a first control valve controlling the flow from the first side of the second hydraulic cylinder to a second pressure limiter arranged between the first side of the second hydraulic cylinder and the input side of the second hydraulic machine. a first electric machine connected to a first hydraulic machine; a second electric machine connected to a second hydraulic machine, an output side of the second hydraulic machine being connected to an input side of the first hydraulic machine; at least one hydraulic consumer hydraulically coupled to an output side of the first hydraulic machine via a supply line and configured to be powered by the first hydraulic machine; a first return line hydraulically coupling the hydraulic consumer to an input side of the first hydraulic machine; wherein the second hydraulic machine is configured to provide a flow of hydraulic fluid from a hydraulic fluid supply to the input side of the first hydraulic machine if a requested flow from the first hydraulic machine exceeds a flow of the first return line and to recuperate energy if the requested flow from the first hydraulic machine is lower than the flow of the first return line; wherein the at least one hydraulic consumer comprises a first hydraulic cylinder connected to the first return line and a second hydraulic cylinder having a second return line directly connected to the input side of the first hydraulic machine and to the output side of the second hydraulic machine, and characterised in that the first return line is connected from a first side of the first hydraulic cylinder to the hydraulic fluid supply via a pressure limiter and to the input side of the first hydraulic machine and to the output side of the second hydraulic machine via a check valve allowing a flow from the first return line to the second return line, wherein the pressure limiter is configured to allow a flow from the first return line to the hydraulic fluid supply if the pressure in the first return line is lower than the pressure in the second return line, and if the pressure of the first return line is higher than a threshold pressure of the pressure limiter, and wherein the system further comprises a return valve block connected to a first side of the second hydraulic cylinder, the return valve block comprising a first return check valve arranged to allow a flow from the first side of the second hydraulic cylinder to the second return line and a first control valve controlling the flow from the first side of the second hydraulic cylinder to a second pressure limiter arranged between the first side of the second hydraulic cylinder and the input side of the second hydraulic machine.