Fixed a bug with an undefined var in pinRegister and pinDismiss