Added controller and servie test and fixed some bugs