Adding window manager unit test and fixing some bugs