Undefined variable fix & replace 'create_function' with lambda