fixed bug in setPin