replaced a closure with create_function to make it work with php 5.2