Fix certain queries with LocalProxy objects