Made config update more thread-safe

Also added 'update_config' method to call before accessing config so
changes take effect as soon as possible.