Fix custom init

More an alternative to your PR than anything else, but this issue revealed a few other subtle bugs that needed fixing.  I also wanted to preserve the test you added.