minor bug squishes and optimizations
minor $dist optimizations