added/fixed variable z in event generator