Cleanup and fixes for automatic update.