Added code to deal with an empty photo history properly.