fixes memory leaks for signatures