fix #251 problem with table relationships