fix errors in gallery view