only update alt attribute if necessary