Get rid of allow_overwrite hack. Added some tests.