Fixed bug that messed up deleting when there are multiple windows.