delete function (ugly without test)