fixed some bugs with service writer