Increase thread safety of 'modify'