Fix bugs on conditional grep, add >/dev/null to some grep, fix minor errors