fix nil nomethod exception in gallery activities