Do not use the magic string "directory". Use the corresponding global variable as in all other places of the module.