Hello Arthur,
Hauptwerk will never turn a virtual key on in response to a MIDI note-off message, so if virtual keys are turning on when you release the physical keys then it must be the case that the MIDI keyboard is incorrectly transmitting MIDI note-on messages when it should be transmitting MIDI note-off messages, but not transmitting the MIDI note-on messages when you press the MIDI keys. That's definitely a hardware issue somewhere (as opposed to anything within Hauptwerk).
Although we can't really help significantly with troubleshooting that, my general suggestions for things to try initially would be:
- Shut everything down and completely remove the power to everything, to make sure everything is is fully reset.
- Check all of the cabling for bad cables or connections.
- Make sure that there is sufficient and reliable power being supplied to the keyboard (since inadequate/unreliable power supplies often cause MIDI encoders to misbehave in strange ways such as that).
- If the keyboard is connected to the computer via a MIDI interface (as opposed to directly, via USB) then make sure it's a good-quality/reputable model, with its latest driver installed.
- Alternatively, if the keyboard is connected to the computer directly via USB, then make sure that it's either connected to a port directly on the computer and that the computer is able to supply sufficient USB bus power for all of the USB devices that are connected to it, or that it's connected via a good-quality (e.g. Belkin) *powered* (not bus-powered) USB 2.0 hub and that the hub's power supply is connected and working properly. Insufficient USB bus power can also cause strange behaviour.
Hope something there helps.