Added removal of main api when deactivated services