fix bug in join query grammar construction.