fixed some bugs with lambda