Fixed bug in load_directory