Fix to setting buffer length to non-default value