fixed script to handle new images