Create the img element on-the-fly instead of using the already created img element with invalid empty src attribute.