Errors fixed in getMessage function