Repare query problem