fixes variable scope of generate_signature method