fixes next photo functionality in photos.js