fixed orphaned rows in database