TWI bugfix and changes