Js photogallery, bug fixes