fixed bug in realloc of input message buffer