Partially fixed on_new_file