Typo.
Added safety check for anonymous functions.
Added tests for anonymous functions.