better attempt at this fix, now with a working test.