changed some lines for double system length in z