output working but tables not joined