code tidy up

fixed delete objects