fix leak in function copy operator
fix leak in optional::reset
use test_element in more tests for leak checking