Fixes for some insidious Windows bugs, + some extensive testing performed.