Fix potential database exception. Fix wrong gallery url.