Bug fix in handling file handlers