bugfixes in windowsystem.cpp