Check return code from validator rather than grep

Thanks @rpiazza for noticing