should work with PHP < 5.3

using anonymous functions doesn't work in PHP < 5.3 and causes a fatal error