Added more locking for pending_changes
Added an option to set values even if they equals the current ones