fixed an infuriating NULL bug in join.script: that function needs to refactored with less replication and more predication