Potential fix for undefined images issue, requires more testing