Buffer error handling fixed. Exception should be thrown before construction of the wrapper.