Fix bug with some missed cases in setPin function.