improve reading file behaviour