Fixed #47, a bug where in some cases the wrong menu appears