fixed: z variable was sometimes meant to be z_trace