fixed service and memory leaks