ApplicationLayer message fixes and unit tests