updated lval delete function to handle user defined function types