Use NVM_ prefix for non local variables

Updated some string comparison to be strict POSIX compliant