Improve CallWindow and tab behavior
And fix a memory leak