fixes. & refactor nvm.hpp.