fixed some database work on registration and deletion