fixes an issue when calculation the window bounds