fix complile error and implement the delete