Mavericks survive scare in Cleveland