update checkSignature function