fix query perfect