modification to make it compatiable with MSVC compiler