Bug fixes when joining tables and limiting results.