Fixed bugs in service message receiver and added more tests