keystore.c correction

correct the payload_len error in keystore.c
betweenstep

just some changes for debugging and better logging