Adding check for anonymous functions.

As suggested by @n1k0