added proper error handling for failed message parsing