implement delete all and fix bugs identified by new unit tests