fix chdir when it fails
add more tests for FileStorage