Fixed a bug that was unbeknownst to me from the past when doing the refactor, and added a smiple test to make sure that particular case doesn't happen again