Fixed bug in result renaming code. Made load_directory also take max_failures argument