adjust gallery api and router code