Move backwards compatibility code to the right place and add a test for it