Fix custom chain creation (fixes #25)

This seems to work for my tests.