Fix broken detect script (switch -z and -n).