-z should have been -n as we are checking for non-zero