Fixed bug in deletion code.