Fixed segfault during writing files
deleted debuging messages