Fixed some small errors, like using max_z instead of length