some fix for windows by takagi (not finished)