Bugfixes for key control