added valid types match to avoid running foobar. added LC_ALL=C to shell cmds