Fixing some file write issues after the services refactoring.