Fixed error messages and added $buffer_size = NULL in the constructor
Updated documentation