Fixed bug in z() method