add debug file output to try to catch crash