really should have written the test suite for this to avoid stuff like this!