fix missed delete in test
Code safety improvements