Fix handling of files