Avoid function nesting error with img url.