Fix wrong window mode switch
Fix typos and mistakes