Fix database issue media query