Fixed bug in pinWrite.