Sync query working fine