Added error handling around i2c