Fix issue with KeyFactory introduced in last commit