Fixes #5283 and #5315

All it took was some fancy switches.