fix window switching in calc mode
mega performance improvements