File logging fixed