Fix undefined variable & replaced a create_function call with a lambda function