problems with Function capturing