Bug fixes for the services refactoring