Fix file mode
Add new test for issue #430