fixed up stack_images()