The problem is in this commented line. When you call the `l` helper, it purges the old version and then loads a new version. By loading a new version, the previous version is now marked as old. So when you get to `:code.delete` to make the current new version as old, you can't actually do it, because the old version slot is still taken, so you do need to explicitly purge once again before. By fixing this, everything else seems to work fine (except the `r` test that still fails).