fixed bug in setPin()