added a check for libkey