correct max z value