limit number of image to be stored and write more tests