Tiny fixes in inmemory and filesystem driver

It consists of go-style fixes and tiny optimizations. 
Also I made inmemory driver thread safe.