Fix bug in service def.
Add test case.