Fix emulation bugs; give LEM own window