remove anonymous function for older versions of php