media rules error handling + other tweaks