some fixes and gallery extension