Fixed some errors causing the I2C bus to hang on receiving data. Still hangs when sending data.