fix join scheme bug

Limit the number of times `scheme()` gets called. Include a test that takes a very long time without this change.

Related to the effort in #317 
fixes #316