Fixes preparation errors

Also adds a new test.