fixed: query error in some cases