more robust validity checker for parsed command