More tests and a fix

Wrote a test I expected to just work but didn't and it exposed a great little bug