Fixed modes
Merged fixes with Windows fixes