Fixed bug that was causing segmentation fault on messages greater than MAX_MSG_SIZE