define img before calling it