fixed erase function for two arguments