Fixes for compile in MSVC
Fixed handling of fake lmd entries plus some compiler warnings