Fix infinite loop problem which attempted to murder the database.