add bad pin handling