fix runtime error on every query