bug in generation txt file