Fixed user interface a little bit

I had trouble getting the program to delete objects if you replace it
with a new one.