L2 regularization

Add l2 regularization, fix memory problem