some fixes

collection of local patches
This is a MSVC warning number, right?