Various fixes for key stuff.