better read-only file handling