fixing query by branch