Try better way of checking if image.. infinite loop