Bug fix for endless loop on img.onload event