fixed issue when using multiple tables