Fix broken key file and other issues