Corrected query sends after client disconecting