null checks for entry and mainWindow