Restore old autojoin logic and a hopefully better fix for the problem jgeboski was trying to solve. #1221 for details.