fix tax rate query and add test covering this issue