patched problem with z <0