fix ondefined name errors
Get rid of filesystem module, use fs library

fs library provides a convenient filesystem/directory abstraction, and
it also comes with an in-memory implementation, that is useful for
testing.