Fixed the resize to handle multiple galleries