Fix small query mistakes, duct tape undefined errors