make command check more robust