Bug fixes. New logic for WindowsBox.lastWindow and WindowsBox.update