Fixed bugs in gallery and change config file